<?php
namespace app\index\controller;

use app\common\model\Inform;
use think\Controller;

class Index extends Controller
{
    static $url = 'http://show.enterlo.com';
    public function index()
    {
        $wallet = new \app\common\model\Wallet();
        return $wallet ->inserts();
    }
    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,你好！' . $name;
    }


    public function ceshi(){
        $token = dataSign([
            'telephone' => '18829244377',
            'date' => time()
        ]);
        $token1 = dataSign([
            'telephone' => '18191027139',
            'date' => time()
        ]);
        $token = 'd9e15d651a22c946bfc32546678e44bd5d0e8d09';
        dump($token1);
        dump($token);
        dump(cache($token));
    }

    public function inserts(){
        $article = new \app\common\model\Article();
        $data = input('param.');
        if ($data){
            $addData['content'] = $data['content'];
            $addData['date'] = time();
            $article -> save($addData);
            return [
                'id' => $article -> id
            ];
        }

        return true;
    }


    public function upload(){
        $url = "./static/upload/lala/";
        $upload = new \app\common\logic\Upload();
        $pathName = $upload -> img('image',$url);

        return $pathName;
    }

    public function nmxvu19g0e(){
        $data = input('param.');
        $this -> assign('searchData',$data);
        $fangsale = \app\common\model\Building::where('company','in',['领郡置业有限公司','房金时代网络科技有限公司'])->column('name');
        $fangsale = array_merge($fangsale,[
            '隆基泰和万和郡',
            '房金时代首页'

        ]);
        $luozhai = \app\common\model\Building::where('company','eq','罗宅网络科技有限公司')->column('name');
        $luozhai = array_merge($luozhai,[
            '碧桂园森林城市',
            '马来西亚富力公主湾',
            '富力公主湾',
            '鼎龙湾',
            '大马金豪',
            '金边富力城',
            '罗宅首页',
            '泰国',
            '榴莲庄主-投资计划',
            '马来西亚',

        ]);
        $building = $data['mark']=='luozhai'?$luozhai:$fangsale;
        $findBuilding[] = ['building','in',$building];
        $findMap[] = ['account_id','eq',0];
        if ($data['key'])
            $findMap[] = ['name|telephone','like',"%$data[key]%"];
        if ($data['building'])
            $findMap[] = ['building','like',"%$data[building]%"];
        $info = \app\common\model\Report::where($findBuilding)->where($findMap)->order('date desc')->select();
        $this -> assign('info',$info);
        $this -> assign('infoNum',count($info));
        $this -> assign('building',$building);
        return view();
    }
}
